Swap and Insert Pull-Down Menus
 
 
 

Using the Customize User Interface (CUI) Editor, you can use workspaces to control the swapping of pull-down menus. However, you can also swap one pull-down menu programmatically for another (for example, when a user loads an application that requires an additional menu).

Swap Pull-Down Menus

Because the program has cascading pull-down menus, there is little need to swap menus. Also, swapping menus can detract from the consistency of the user interface. However, using $ commands, you can swap pull-down menus and submenus. An alternative to menu swapping involves relative (or global) referencing. Using this method, you can insert the new menu in front of a known menu and then remove the known menu.

For menu-swapping purposes, the pull-down menu areas are named P1 through P16. You can change the title that appears in the menu bar by replacing that line of the menu with a $Pn= command. You can use the special command $Pn=* from within any command to force the menu currently assigned to area POPn to pull down for greater flexibility in movement of the pointing device.

The following macro example replaces a menu at position P3 with the menu named MyMenu in the customization group named MYMENU.

$P3=mymenu.new3

The same thing can be done with the AutoLISP menucmd function as follows:

(menucmd "P3=mymenu.new3")

You can use the $Pn=* special command from within any macro to force the menu currently assigned to area POPn to be displayed.

NoteThe swapping of pull-down menus does not conform to the Microsoft® user interface guidelines and is not guaranteed to be available in future releases of the program.

Insert and Remove Pull-Down Menus

Menu swapping is done by activating one menu directly from another menu. Menu swapping is supported for the following interface elements:

The syntax for the swapping of partial menus is as follows:

$section=customizationgroup.menuname

section

B1-4, A1-4, P0-16, T1-4

customizationgroup

Customization group name in the desired CUIx file

menuname

Main label or alias

You can use the AutoLISP menucmd function to insert or remove a pull-down menu. The syntax is similar to that used to swap pull-down menus except that the left side of the assignment is the pull-down menu before which the new menu will be inserted. The right side of the assignment is a plus sign (+) followed by the name of the menu group, a period, and the menu's alias, as shown in the following syntax:

(menucmd "customizationgroup1.menuname1=+customizationgroup2.menuname2")

You can also insert a menu with the Pn= syntax. The following macro inserts a menu after the P5 menu.

(menucmd "P5=+mymenu.new3")
$P5=+mymenu.new3

If you use this method to insert a menu, remember that you cannot rely on its being inserted at the P6 menu location as you might expect. There are two reasons that this may not be the case.

This is the syntax for removing a menu:

(menucmd "Gcustomizationgroup.menuname=-")
Gcustomizationgroup.menuname=-

The following shows how to remove the menu NEW3 that is a member of the MyMenu group.

(menucmd "Gmymenu.new3=-")
$Gmymenu.new3=-"

As you might expect, the preceding format is preferable to the Pn= format because it removes only the specified menu. The following shows how to remove the menu at the P4 location (whatever it is).

(menucmd "P4=-")
$P4=-
NoteUse the Pn syntax as part of the syntax for a menucmd statement only. Use the $Pn syntax for macro-specific statements.

Control Toolbars Across Partial CUIx Files

To control toolbars across partial CUIx files, use the following syntax at the Enter toolbar name or [ALL]: prompt of the -TOOLBAR command.

menugroup.subsection-name

This syntax accesses the toolbar identified by menugroup.menuname and allows you to use the full spectrum of -TOOLBAR command options on that toolbar.

If the menu group is left out of any of these commands and functions, the program defaults to the main CUIx file.

You should be aware of the following:

Quick Reference
Commands